import java.util.Scanner;

/**
 * @author vivi
 * @description
 * @date 2024/5/10
 */
public class demo2 {
    public static void main (String[] args) {
        Scanner scanner = new Scanner(System.in);
        int lenArr = scanner.nextInt();
        int[] arr = new int[lenArr];

        int max = 0;
        for(int i = 0; i < lenArr; i++)
        {
            arr[i] = scanner.nextInt();
            max = Math.max(max, arr[i]);
        }

        boolean flag = false;
        for (int i = 0; i < lenArr; i++) {
            if (max % arr[i] == 0) {
                flag = true;
                break;
            }
            int x = max / arr[i];
            if ((x - (x & - x)) != 0) {
                flag = false;
                break;
            }
        }

        if (flag == true){
            System.out.println("YES");
        }else {
            System.out.println("NO");
        }
    }
}
